1. Field of the Invention
The present invention relates to a communication apparatus, a method of controlling the same, and a storage medium.
2. Description of the Related Art
In recent years, printing apparatuses, such as multi function peripherals and printers, having a wireless LAN function are increasing. It is common for printing apparatuses having wireless LAN to be provided with a function for connecting wirelessly to an access point as a client. Meanwhile, PCs and mobile terminals are being used for device management in which they communicate with a printing apparatus via an access point, causing the printing apparatus to print desired data by transmitting it, and receiving device information from the printing apparatus.
Meanwhile, in recent years, Wi-Fi Direct (registered trademark) (hereinafter referred to as Wi-Fi Direct) has been established by The Wi-Fi Alliance With Wi-Fi Direct a protocol is defined in which it is determined whether wireless terminals will operate as an access point or as a client. By executing this protocol, it can be automatically decided which wireless terminal will be an access point, and which will be a client. By using Wi-Fi Direct, it becomes unnecessary to prepare an access point separately, and various application services (image sharing, printing, etc.) are executable by direct communication between the wireless terminals.
With printing apparatuses in which the above described protocol is executable, configuration may be taken so that a user can instruct from a control panel, or the like, whether to perform wireless communication directly using Wi-Fi Direct, or whether to perform wireless communication indirectly via a third party access point.
However, there are cases in which problems arise when in the middle of receiving print data from a communication terminal such as a PC by a method of indirect wireless communication, for example, instruction is made for switching operation to direct wireless communication using Wi-Fi Direct. In other words, in such a case, when switching processing is executed immediately, a print material for which the user operating the communication terminal instructed printing is cut off forcibly in the process of printing without being printed to the end. In order to avoid this kind of problem, ideas have been proposed (for example, Japanese Patent Laid-Open No. 2012-113349).
In Japanese Patent Laid-Open No. 2012-113349, a printing apparatus having an infrastructure mode for performing wireless communication with a terminal apparatus via an access point, and an adhoc mode for performing wireless communication directly one-to-one between terminal apparatuses without going through an access point is recited. When a switching from the infrastructure mode to the adhoc mode is instructed by a user, determination is made as to whether or not currently print data is being received in the infrastructure mode, the switching not performed in such a case, and the user is notified of such by displaying to a display unit.
However, cases other than when print data is being received in which it is better to not perform the above described mode switching other also exist. Amongst these there exist cases unlike when print data is being received in which it cannot be discriminated immediately whether “now is a timing at which it is better to not perform the switching” for the user. For example, in a case where a printing apparatus is operating in Wi-Fi Direct, multiple mobile terminals can connect simultaneously to the printing apparatus. Accordingly, even in a case where the user of a mobile terminal ends a connection with the printing apparatus by Wi-Fi Direct, there is the possibility that a user of another mobile terminal is still connected to the printing apparatus. Here, when the user that ends the connection switches the printing apparatus to an indirect wireless communication mode rather than Wi-Fi Direct, the user of the other mobile terminal may be disconnected in mid-communication In order to avoid these kinds of situations, it is necessary for the user to check that no other user that is currently connected using Wi-Fi Direct exists by checking a communication status of the printing apparatus before performing the switching operation of switching the printing apparatus mode. This kind of check needs to be performed every time, which is cumbersome for the user.